<%--
  Created by IntelliJ IDEA.
  User: 神🍭仙💤
  Date: 2019/6/20
  Time: 17:34
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" type="text/css" href="/common/layui/css/layui.css" media="all">
    <link rel="stylesheet" type="text/css" href="/common/bootstrap/css/bootstrap.css" media="all">
    <link rel="stylesheet" type="text/css" href="/common/global.css" media="all">
    <link rel="stylesheet" type="text/css" href="/css/personal.css" media="all">

    <title>单位信息确认修改</title>
    <%--<link rel="stylesheet" href="common/layui/css/layui.css" media="all">--%>
</head>
<script src="/js/jquery2.js"></script>

<script>
    function xx() {
        $.ajax({
            type: "POST",
            url: "/XiaoJianCompanyinfoController/updateCompanyinfos",
            data: $("#formdata").serialize(),
            dataType: "json",
            success: function (date) {
                if (date.i != 0) {
                    alert("修改成功！")
                } else {
                    alert("修改失败！")
                }

            },
            error: function () {
            }
        });
    }
</script>
<body>
<section class="layui-larry-box">
    <div class="larry-personal">
        <header class="larry-personal-tit">
            <span>单位信息</span>
        </header><!-- /header -->
        <div class="larry-personal-body clearfix">
            <script src="js/input.js"></script>
            <form class="layui-form col-lg-5" id="formdata">
                <div class="layui-form-item">
                    <label class="layui-form-label">单位名称:</label>
                    <div class="layui-input-block">
                        <input type="text" name="cname" required lay-verify="required" value="${companyinfos[0].cname}"
                               autocomplete="off" placeholder="请输入单位名称" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">法人代言:</label>
                    <div class="layui-input-block">
                        <input type="text" name="clowyer" lay-verify="required" value="${companyinfos[0].clowyer}"
                               autocomplete="off" placeholder="请输入法人代言" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">单位负责人:</label>
                    <div class="layui-input-block">
                        <input type="text" name="cleader" lay-verify="required" value="${companyinfos[0].cleader}"
                               autocomplete="off" placeholder="请输入单位负责人" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">所属行业:</label>
                    <div class="layui-input-block">
                        <input type="text" name="ctype" lay-verify="required" value="${companyinfos[0].ctype}"
                               autocomplete="off" class="layui-input" placeholder="请输入所属行业">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">经济类型:</label>
                    <div class="layui-input-block">
                        <input type="text" name="jitype" lay-verify="required" value="${companyinfos[0].jitype}"
                               autocomplete="off" class="layui-input" placeholder="请输入经济类型">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">单位地址:</label>
                    <div class="layui-input-block">
                        <input type="text" name="caddress" lay-verify="required" value="${companyinfos[0].caddress}"
                               autocomplete="off" class="layui-input" placeholder="请输入单位地址">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">邮政编码: </label>
                    <div class="layui-input-block">
                        <input type="text" name="cbian" lay-verify="number" value="${companyinfos[0].cbian}"
                               autocomplete="off" class="layui-input" placeholder="请输入邮政编码">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">单位网址: </label>
                    <div class="layui-input-block">
                        <input type="text" name="curl" lay-verify="url" value="${companyinfos[0].curl}"
                               autocomplete="off" class="layui-input" placeholder="请输入单位网址">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">电子邮箱: </label>
                    <div class="layui-input-block">
                        <input type="text" name="cemail" lay-verify="email" value="${companyinfos[0].cemail}"
                               autocomplete="off" class="layui-input" placeholder="请输入电子邮箱">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">单位电话: </label>
                    <div class="layui-input-block">
                        <input type="text" name="ctel" lay-verify="number" value="${companyinfos[0].ctel}"
                               autocomplete="off" class="layui-input" placeholder="请输入单位电话">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">单位传真: </label>
                    <div class="layui-input-block">
                        <input type="text" name="cfax" lay-verify="required" value="${companyinfos[0].cfax}"
                               autocomplete="off" class="layui-input" placeholder="请输入单位传真">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">单位成立时间: </label>
                    <div class="layui-input-block">
                        <input type="text" disabled name="createtime" lay-verify="required"
                               value="${companyinfos[0].createtime}" autocomplete="off" class="layui-input"
                               placeholder="请输入单位成立时间">
                    </div>
                </div>

                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">单位介绍：</label>
                    <div class="layui-input-block">
                        <textarea placeholder="既然选择了远方，便只顾风雨兼程；路漫漫其修远兮，吾将上下而求索" lay-verify="required" name="cinfo"
                                  class="layui-textarea">${companyinfos[0].cinfo}</textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="formDemo" id="insertdata">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        <a href="/updatecompanyinfo.jsp" type="reset" class="layui-btn layui-btn-primary">返回</a>
                    </div>
                </div>
            </form>

            <script type="text/javascript" src="/common/layui/layui.js"></script>
            <script type="text/javascript" src="/js/newslist.js"></script>
        </div>
    </div>
</section>
</body>
<script>

    layui.use('form', function () {
        var form = layui.form();
        //各种基于事件的操作，下面会有进一步介绍
        form.on('submit(formDemo)', function (data) {
            console.log(data.elem) //被执行事件的元素DOM对象，一般为button对象
            console.log(data.form) //被执行提交的form对象，一般在存在form标签时才会返回
            console.log(data.field) //当前容器的全部表单字段，名值对形式：{name: value}
            xx();//执行ajax
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
    });
</script>

</html>
